#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
const int N = 410;
int q[N][N];
typedef pair<int, int> pii;
int n, m, x, y;
int dx[8] = { 1,2,2,1,-1,-2,-2,-1 };
int dy[8] = { 2,1,-1,-2,-2,-1,1,2 };
void bfs()
{
    memset(q, -1, sizeof(q));
    queue<pii> as;
    q[x][y] = 0;
    as.push({ x,y });
    while (as.size())
    {
        auto e = as.front();
        as.pop();
        int i = e.first;
        int j = e.second;
        for (int k = 0; k < 8; k++)
        {
            int a = i + dx[k];
            int b = j + dy[k];
            if (a<1 || a>n || b<1 || b>m || q[a][b] != -1)
            {
                continue;
            }
            q[a][b] = q[i][j] + 1;
            as.push({ a,b });
        }
    }
}
int main()
{
    cin >> n >> m >> x >> y;
    bfs();
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            cout << q[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}